package com.starinside.wp.controller.api;

import com.starinside.wp.foundation.model.StatusResponse;
import com.starinside.wp.utils.HttpClient;
import com.starinside.wp.utils.JsonUtil;
import io.swagger.annotations.Api;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.Map;

/**
 * @author mengzhichao
 * @create 2025-02-27-9:44
 */

@RestController
@RequestMapping("/children_month_record")
@Api(tags = "宝宝模块")
public class TeachYueBaoApiController {

    @Value("${teach.server.url}")
    private String teachServerURL;


    @Value("${evaluate.server.url}")
    private String evaluateServerURL;



    /**
     * 新增请假
     */
    @PostMapping("/list1")
    public StatusResponse saveChildrenLeaveRequest(@RequestBody Map aboutPallet) throws IOException {
        String json = HttpClient.doPost(teachServerURL + "/api/pad/children_month_record/list1",aboutPallet);
        Map map = JsonUtil.readToMap(json);
        return StatusResponse.success(map.get("data"));
    }


    /**
     * 新增请假
     */
    @PostMapping("/get1")
    public StatusResponse saveChildrenLeaveRequest1(@RequestBody Map aboutPallet) throws IOException {
        String json = HttpClient.doPost(teachServerURL + "/api/pad/children_month_record/get1",aboutPallet);
        Map map = JsonUtil.readToMap(json);
        return StatusResponse.success(map.get("data"));
    }



    /**
     * 新增请假
     */
    @PostMapping("/get2")
    public StatusResponse saveChildrenLeaveRequest2(@RequestBody Map aboutPallet) throws IOException {
        String json = HttpClient.doPost(evaluateServerURL + "/api/evaluate/eapi/bmi/info1",aboutPallet);
        Map map = JsonUtil.readToMap(json);
        return StatusResponse.success(map.get("data"));
    }



}
